package com.swa.facebookdownloader.dialog;

import java.io.File;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.view.View.OnClickListener;

import com.swa.facebookdownloader.R;
import com.swa.facebookdownloader.util.Util;

public class DialogUtils {

	public static void createName(final Context mContext, final Uri uri) {
		final NameDialog nameDialog = new NameDialog(mContext, uri);
		nameDialog.show();
		nameDialog.btn_continue.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {

				String name = nameDialog.name_edt.getText().toString();
				Util.goVideo_Download(mContext, uri, name);
				nameDialog.dismiss();

			}
		});
	}

	public static void SelectUpdateDialog(final Context mContext) {

		String a = mContext.getResources().getString(R.string.update_dialg);

		AlertDialog.Builder alt_bld = new AlertDialog.Builder(mContext);
		alt_bld.setMessage(a)
				.setCancelable(false)
				.setPositiveButton(R.string.update,
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog, int id) {
								Uri uri = Uri
										.parse("market://details?id=com.swa.facebookdownloader");
								Intent intent = new Intent(Intent.ACTION_VIEW,
										uri);
								mContext.startActivity(intent);
							}
						})
				.setNegativeButton(R.string.cancel,
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog, int id) {
								dialog.cancel();
							}
						});
		AlertDialog alert = alt_bld.create();
		alert.show();
	}

}
